fix: overflow with long words - #1215
Merged
Merged
Conversation
- Will hyphenate words when browser support the language (https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens) - Added exceptions for things that should not be hyphenated (https://meyerweb.com/eric/thoughts/2012/12/17/where-to-avoid-css-hyphenation/)
maxelkins
temporarily deployed
to
previews/1215/merge
June 13, 2025 16:00 — with
GitHub Actions
Inactive
maxelkins
marked this pull request as draft
June 13, 2025 16:08
maxelkins
marked this pull request as ready for review
June 13, 2025 16:12
Contributor
Author
maxelkins
temporarily deployed
to
previews/1215/merge
June 17, 2025 14:12 — with
GitHub Actions
Inactive
By setting `scroll` rather than `auto` scrollbar is shown even when there is no overflow
maxelkins
temporarily deployed
to
previews/1215/merge
June 17, 2025 14:37 — with
GitHub Actions
Inactive
adrian-rpf
reviewed
Jun 17, 2025
adrian-rpf
left a comment
Contributor
There was a problem hiding this comment.
@maxelkins Changes make sense based on your thread with @loiswells97
What testing has been done on:
- Different code projects
- Browser viewport sizes?
loiswells97
requested changes
Jun 18, 2025
maxelkins
temporarily deployed
to
previews/1215/merge
June 18, 2025 12:50 — with
GitHub Actions
Inactive
maxelkins
temporarily deployed
to
previews/1215/merge
June 18, 2025 15:59 — with
GitHub Actions
Inactive
maxelkins
commented
Jun 18, 2025
maxelkins
enabled auto-merge (squash)
June 18, 2025 16:31
maxelkins
disabled auto-merge
June 18, 2025 21:19
Contributor
Author
Further examplesTested with small size sizebar with some instructions (best example of long form content in sidebar). Plus with some code just to make sure it isnt doing anything funky. I'd like to test with the projects site projects but this is proving tricky. Although not perfect, I'd prefer only to hyphenate when words can't be wrapped (such as this proposal, ths currently isn't possible and this solution at least covers more problems with localisation. We can always tune the Note the line height issues on viewing instructions content are not related to this. |
Merged
jamiebenstead
added a commit
that referenced
this pull request
Jul 22, 2025
## [0.30.2] - 2025-07-22 ### Fixed - Styling issue preventing scrolling in the sidebar (#1216) - Styling issue on status bar on mobile (#1217) - Change tab `block-size` to `min-block-size` to allow for height increase when text wraps (#1219) - Changed `SkulptRunner.jsx` implementation of hiding elements to use `display: none` rather than `block-size: 0` (#1219) - Enabled `hyphens: auto` globally (with exceptions) to prevent overflow with longer words (#1215) - Removed fixed size from `ProjectBar` to prevent overflow when text wraps (#1221) - Added missing translation strings (#1222) - Changed `colour_raw` to now correctly return a 4-tuple (R, G, B, Clear) in simulation ### Changed - Improved status bar styling (#1221) - Added horizontal scrollbar to editor (#1228) - Add theme for scrollbars (#1233)
jamiebenstead
added a commit
that referenced
this pull request
Jul 28, 2025
## [0.30.2] - 2025-07-22 ### Fixed - Styling issue preventing scrolling in the sidebar (#1216) - Styling issue on status bar on mobile (#1217) - Change tab `block-size` to `min-block-size` to allow for height increase when text wraps (#1219) - Changed `SkulptRunner.jsx` implementation of hiding elements to use `display: none` rather than `block-size: 0` (#1219) - Enabled `hyphens: auto` globally (with exceptions) to prevent overflow with longer words (#1215) - Removed fixed size from `ProjectBar` to prevent overflow when text wraps (#1221) - Added missing translation strings (#1222) - Changed `colour_raw` to now correctly return a 4-tuple (R, G, B, Clear) in simulation ### Changed - Improved status bar styling (#1221) - Added horizontal scrollbar to editor (#1228) - Add theme for scrollbars (#1233)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Overview
This PR aims to solve this problem globally rather than just in the 1 instance spotted as I suspect this is happen frequently with translations.
If we feel this is to aggressive since it does hyphen instead of wrapping nomally in some instances, we could just apply it to the info-panel in the sidebar.
Additional notes
Result
Note to preview this you must manually set the html lang to "de" since hyphenation relies on the browser implementation and our demo language (XX-xx) is not a real locale
Useful resources
Suggested solutions
Option 1 (currently implemented)
hyphen: autoglobally (with exceptions)hyphen-limit-chars(mdn ref) to avoid over hyphenating\u00ADcan be used by the translation team to encourage preffered hyphenationsPros:
hyphen-limit-charsis an easy progressive enchancement, as the experience is not broken (although not ideal) without it.Cons:
hyphenate-limit-charsthe browser seems to overly hyphen rather than wrapping text when possible, which could argueably be hard to read.hyphen-limit-charsExamples:
Auto inserted hyphens (hyphen limit could still be adjusted):
Without
hyphen-limit-chars(en):with
hyphen-limit-chars(en):Option 2
hyphens: manual. This enables the translation team to manually insert (soft) hyphens to enourage words to break in ideal positions when they are long.overflow-wrap: break-word;can be used as a fallback to wrap words (without hyphens) if manual soft hyphens have not been set.Pros:
Cons:
overflow-wrap: break-worddoes NOT insert hyphens which can be confusing and hard to read.Example:
Option 3
Pros:
Cons: